<?php
namespace Admin\Controller;
use Think\Controller;
/**
 * 幻灯片管理控制器
 */
 class SlideController extends IsLoginController{
 	/**
	 * 幻灯片管理首页
	 */
 	public function index(){
 		$slide = M('slide')->select();
		$this->assign('slide',$slide);
 		$this->display();
 	}
	
	/**
	 * 添加幻灯片图片
	 */
	 public function add(){
	 	if(IS_POST){
	 		$solide = D('slide');
			if(!$solide->addSlide()){
				$this->error($solide->getError());
				return false;
			}
			$this->success('添加成功');
	 	}
	 	$this->display();
	 }
	 
	 
	 /**
	 * 修改幻灯片图片
	 */
	 public function edit(){
	 	if(IS_POST){
	 		$solide = D('slide');
			if(!$solide->editSlide()){ echo $solide->getError();
				$this->error($solide->getError());
				return false;
			}
			$this->success('修改成功');
	 	}
		//查询信息分配视图
		$sid = I('get.sid');
		$slide = M('slide')->where("s_id='{$sid}'")->find();
		$this->assign('slide',$slide);
	 	$this->display();
	 }
	 
 }
